import { join } from 'node:path'
import { Sequelize } from 'sequelize'
import { MyDirPath } from '../../app.config.js'
// 常量声明
const FILE_PATH = join(MyDirPath, '/resources/data/kong.sqlite3')

const pool = {
  max: 10, // 最大连接数
  min: 1, // 最小连接数
  acquire: 30000, // 获取连接的超时时间
  idle: 10000 // 和空闲连接的超时时间
}

const sequelizePool = new Sequelize({
  dialect: 'sqlite',
  storage: FILE_PATH,
  pool: pool
})

export default sequelizePool
